﻿Imports Send2Twitter

<ExportCompent(GetType(IInfoSender), "Sina Weibo", "bd5c3fcd-c978-44e0-a8e3-04f54d596097", "1.0.0.0")>
Public Class SinaSender
    Inherits InfoSenderBase

    Private _sender As SinaWeiboSender.SinaOAuth

    Public Overrides Function GetAvailability() As Boolean
        Return Not (String.IsNullOrEmpty(My.Settings.Token) OrElse String.IsNullOrEmpty(My.Settings.TokenSecret))
    End Function

    Public Overrides Sub SendInfo(message As String)
        _sender.Update(message)
    End Sub

    Public Overrides Sub ShowSetting()
        Dim sw As New SettingWindow
        sw.Show()
        _sender.AddToken(My.Settings.Token, My.Settings.TokenSecret)
    End Sub

    Public Overrides Sub ShutDown()
        My.Settings.Save()
    End Sub

    Public Overrides Sub StartUp()
        If Me.GetAvailability Then
            _sender = New SinaOAuth("639030757", "22166d80197513347b1b373f723559c0", My.Settings.Token, My.Settings.TokenSecret)
        Else
            _sender = New SinaOAuth("639030757", "22166d80197513347b1b373f723559c0")
        End If
    End Sub
End Class
